package com.bailun91.auth.mapper;


import com.bailun91.auth.entity.Permission;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface PermissionMapper {

  /**
   * 查询某个角色对应的权限
   * @param roleId
   * @return
   */
  @Select("SELECT p.* FROM c_role_permission rp\n" +
          "LEFT JOIN c_permission p ON (p.permission_id = rp.permission_id)\n" +
          "WHERE rp.role_id = #{role_id};")
  List<Permission> findPermissionListByRoleId(@Param("role_id") int roleId);

}
